name: CI for tests

on:
    pull_request:
        branches:
            - "master"
    push:
        branches:
            - "*"
            - "!master"

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Set up QEMU
              uses: docker/setup-qemu-action@v1
            - name: Set up Docker Buildx
              uses: docker/setup-buildx-action@v1
            - name: Build dockerfile (without push)
              run: |
                  docker buildx build \
                  --platform=linux/amd64,linux/arm/v7,linux/arm64 \
                  --output "type=image,push=false" \
                  --file ./Dockerfile .
    automerge:
        needs: build
        runs-on: ubuntu-latest
        permissions:
            pull-requests: write
            contents: write
        steps:
            - uses: fastify/github-action-merge-dependabot@v3
              if: >-
                  ${{ github.actor == 'dependabot[bot]' && github.event_name ==
                  'pull_request' }}
              with:
                  github-token: ${{ secrets.GITHUB_TOKEN }}
